<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>
    function Parent(){
        this.skill = "挣钱"
    }
    Parent.prototype.show = function(){
        console.log(this.skill + " show")
    }
    Parent.prototype.init = function(){
        console.log(this.skill + " init")
    }

    function Child(){
        this.skill = "花钱"
    }
    // 拷贝原型对象(注意深浅拷贝)
    
    // Child.prototype = {
    //     ...Parent.prototype
    // }
    // for(var i in Parent.prototype){
    //     Child.prototype[i] = Parent.prototype[i]
    // }
    Object.assign(Child.prototype, Parent.prototype)

    Child.prototype.init = function(){
        console.log("hello world")
    }

    var p = new Parent();
    console.log(p)
    p.show();
    p.init();
    console.log(p.__proto__)

    var c = new Child();
    console.log(c)
    c.show();
    c.init();
    console.log(c.__proto__)


    // 原型对象继承
    // 只能继承原型，不能继承构造函数




</script>
</html>